package com.mr.service.api;

import com.mr.service.pojo.SpecGroup;
import com.mr.service.pojo.SpecParam;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RequestMapping("spec")
public interface SpecApi {


    @GetMapping("groups/{cid}")
    public List<SpecGroup> querySpecGroupList(@PathVariable("cid") Long cid);

    @GetMapping("/params")
    public List<SpecParam> querySpecParam(
            @RequestParam(value="gid", required = false) Long gid,
            @RequestParam(value="cid", required = false) Long cid,
            @RequestParam(value="searching", required = false) Boolean searching,
            @RequestParam(value="generic", required = false) Boolean generic
    );

    @PostMapping("group")
    public ResponseEntity<Void> addSpec(@RequestBody SpecGroup entity);

    @PostMapping("param")
    public ResponseEntity<Void> save(@RequestBody SpecParam entity);


    @DeleteMapping("group/{id}")
    public  ResponseEntity deleteSpec(@PathVariable("id") Long id);

    @DeleteMapping("param/{id}")
    public  ResponseEntity delete(@PathVariable("id") Long id);

    @PutMapping("group")
    public ResponseEntity<Void> updataSpec(@RequestBody SpecGroup entity);

    @PutMapping("param")
    public ResponseEntity<Void> Updata(@RequestBody SpecParam entity);
}
